<!--
 * @Author: ChaiHongJun
 * @Date: 2021-04-03 17:51:02
 * @LastEditors: ChaiHongJun
 * @LastEditTime: 2021-04-08 18:15:37
 * @version: 
 * @Description:歌手组件
-->
<template>
  <div class="load-more">
    <ul class="singer-list">
      <li v-for="(artist, index) of artists" :key="index">
        <div class="cover">
          <div class="image">
            <el-image :src="artist.img1v1Url + '?param=200y200'"></el-image>
          </div>
        </div>
        <div class="info">
          <p class="name">{{ artist.name }}</p>
          <p class="count">单曲数： {{ artist.musicSize }}</p>
        </div>
      </li>
    </ul>
  </div>
</template>
<script>
import { getScrollTop, getClientTop, getScrollHeight } from "@/utils/index.js";
export default {
  name: "loadingMore",
  data() {
    return {};
  },
  props: {
    artists: {
      type: Array,
    },
  },
  computed: {},
  mounted() {
    //判断页面滚动
    let _this = this;
    document.addEventListener(
      "scroll",
      function () {
        if (getScrollTop() + getClientTop() + 1 >= getScrollHeight()) {
          //当滑动到一定位置，触发加载更多事件

          _this.$emit("loadMore");
        }
      },
      true
    );
  },
  methods: {},
};
</script>
<style lang="stylus" scoped>
.singer-wrap {
  // height: 100vh;
  margin-top: -20px;

  li {
    &:hover {
      color: $color-theme;
      transition: all 0.4s;
    }
  }

  .tag-en {
    display: flex;
    flex-wrap: wrap;
    margin-top: 10px;

    li {
      width: 28px;
      height: 28px;
      margin-right: 14px;
      text-align: center;
      line-height: 29px;
      border-radius: 50%;
      font-size: 13px;
      color: #333333;
      cursor: pointer;

      &:first-child, &.last-child {
        width: 56px;
        border-radius: 14px;
      }

      &.active {
        background: $color-theme;
        font-weight: 700;
        color: #ffffff;
      }

      &:hover {
        color: $color-theme;
        transition: all 0.4s;
      }
    }
  }

  .tag-lang {
    display: flex;
    margin-top: 20px;
    margin-bottom: 20px;

    li {
      width: 56px;
      height: 28px;
      line-height: 29px;
      font-size: 13px;
      text-align: center;
      border-radius: 14px;
      cursor: pointer;
      margin-right: 6px;

      &.active {
        background: $color-theme;
        font-weight: 700;
        color: #ffffff;
      }
    }
  }

  .tag-type {
    li {
      width: auto;
      padding: 0 15px;
    }
  }

  .singer-list {
    display: flex;
    flex-wrap: wrap;
    margin-top: 30px;
    margin: 30px -15px 0;
  }
}

li {
  padding: 0 15px 30px;
  flex: 0 0 10%;
  max-width: 10%;

  .cover {
    position: relative;
    z-index: 2;
    padding-top: 100%;
    border-radius: 50%;
    background-color: #d9d9d9;

    .image {
      position: absolute;
      top: 0;
      left: 0;
      overflow: hidden;
      width: 100%;
      height: 100%;
      border-radius: 50%;

      img {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 100%;
      }

      &:after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border-radius: 50%;
        -webkit-box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.05) inset, -1px -1px 0 rgba(0, 0, 0, 0.05) inset;
        box-shadow: inset 1px 1px 0 rgba(0, 0, 0, 0.05), inset -1px -1px 0 rgba(0, 0, 0, 0.05);
      }
    }
  }

  .info {
    margin-top: 15px;
    text-align: center;

    .name {
      font-weight: 700;
      font-size: 14px;
      line-height: 18px;
      word-break: break-word;
    }

    .count {
      font-size: 12px;
      margin-top: 10px;
      color: $color-theme;
    }
  }
}
</style>